LetsGrowMore
¶
Name : Varsha Reddy
¶
Level : Beginner
¶
Task 2 - IMAGE TO PENCIL SKETCH
¶
1.We need to read the image in RBG format and then convert it to a grayscale image. This will turn an image into a classic black and white photo.
¶
2.then the next thing to do is invert the grayscale image also called Negative image,this will be our inverted grayscale image.
¶
3.Inversion can be used to enhance details.
¶
4.Then we can finally create the Pencil sketch by mixing the grayscale image with the inverted blurry image.¶
¶
5.This canbe done by dividing the gray scale image by the inverted blurry image.
¶
6.Since images are just arrays, we can easily do this programmatically using the divide function from the cv2 library in python.¶
¶
In [2]:
import
cv2
In [3]:
from
PIL
import
Image
In [4]:
img
=
cv2
.
imread
(
'Flower.jpg'
)
In [5]:
display
(
Image
.
fromarray
(
img
))